Monitoring Compressor and Decompressor Progress

The following example shows how the ICSetStatusProcBHKDX function is used to inform the compressor or decompressor of the callback function address:

ICSetStatusProc(compvars.hic, 0, (LPARAM) (UINT) hwndApp,

    &PreviewStatusProc);

 

The following example shows the callback function installed by the previous fragment:

LONG CALLBACK export PreviewStatusProc(LPARAM lParam,

    UINT message, LONG l)

    switch (message)

   

        MSG msg;

        case ICSTATUS_START:

        

        // Create and display status dialog box.

        

            break;

        case ICSTATUS_STATUS:

            ProSetBarPos((int) l); // sets status bar positions

 

        // Watch for abort message

            while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))

           

                if (msg.message == WM_KEYDOWN && msg.wParam ==

                    VK_ESCAPE)

                    return 1;

                if (msg.message == WM_SYSCOMMAND &&

                    (msg.wParam & 0xFFF0) == SC_CLOSE)

                    return 1;

 

                TranslateMessage(&msg);

                DispatchMessage(&msg);

            }

            break;

        case ICSTATUS_END:

         

        // Close and destroy status dialog box.

        

            break;

        case ICSTATUS_YIELD:

        

        

        

            break;

    }

    return 0;

}